Fix leak in GtkStyle.
authorCarlos Garnacho <carlosg@gnome.org>
Sat, 25 Dec 2010 10:59:56 +0000 (11:59 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 28 Dec 2010 18:06:46 +0000 (19:06 +0100)
gtk/gtkstyle.c

index 40c39286723f7a29676c0961b84dd92186c59bc2..5eb6a20085a7df9d4aba5b93cd9d4ef8b9872284 100644 (file)
@@ -745,9 +745,14 @@ gtk_style_update_from_context (GtkStyle *style)
   style->white.blue = 0xffff;
 
   for (i = 0; i < 5; i++)
-    style->background[i] = cairo_pattern_create_rgb (style->bg[i].red / 65535.0,
-                                                     style->bg[i].green / 65535.0,
-                                                     style->bg[i].blue / 65535.0);
+    {
+      if (style->background[i])
+        cairo_pattern_destroy (style->background[i]);
+
+      style->background[i] = cairo_pattern_create_rgb (style->bg[i].red / 65535.0,
+                                                       style->bg[i].green / 65535.0,
+                                                       style->bg[i].blue / 65535.0);
+    }
 }
 
 static void